package com.example.trance.controller;

import com.example.trance.async.TranceAsyncTest;
import com.example.pojo.vo.common.Result;
import com.example.util.common.ThreadMdcUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 测试正负面
 */
@RestController
@Slf4j
public class TestController {

    @Autowired
    TranceAsyncTest tranceAsyncTest;



    /**
     * 测试异步任务，线程吃任务，异步线程池任务，是否断链
     */
    @GetMapping(value = "/tranceAsyncTest")
    @ResponseBody
    public Result tranceAsyncTest() {
        log.info("start tranceAsyncTest");
        tranceAsyncTest.aAsyncTaskTest();
        tranceAsyncTest.bAsyncTaskTest();
        tranceAsyncTest.cExecutorTaskTest();
        tranceAsyncTest.dExecutorTaskTest();
        return Result.OK(ThreadMdcUtil.getTranceId());
    }


}
